C   IMSL ROUTINE NAME   - USPKD                                         USPD0010
C                                                                       USPD0020
C-----------------------------------------------------------------------USPD0030
C                                                                       USPD0040
C   COMPUTER            - HP1000/SINGLE                                 USPD0050
C                                                                       USPD0060
C   LATEST REVISION     - JUNE 1, 1982                                  USPD0070
C                                                                       USPD0080
C   PURPOSE             - NUCLEUS CALLED BY IMSL ROUTINES THAT HAVE     USPD0090
C                           CHARACTER STRING ARGUMENTS                  USPD0100
C                                                                       USPD0110
C   USAGE               - CALL USPKD  (PACKED,NCHARS,UNPAKD,NCHMTB)     USPD0120
C                                                                       USPD0130
C   ARGUMENTS    PACKED - CHARACTER STRING TO BE UNPACKED.(INPUT)       USPD0140
C                NCHARS - LENGTH OF PACKED. (INPUT)  SEE REMARKS.       USPD0150
C                UNPAKD - INTEGER ARRAY TO RECEIVE THE UNPACKED         USPD0160
C                         REPRESENTATION OF THE STRING. (OUTPUT)        USPD0170
C                NCHMTB - NCHARS MINUS TRAILING BLANKS. (OUTPUT)        USPD0180
C                                                                       USPD0190
C   PRECISION/HARDWARE  - SINGLE/ALL                                    USPD0200
C                                                                       USPD0210
C   REQD. IMSL ROUTINES - NONE                                          USPD0220
C                                                                       USPD0230
C   REMARKS  1.  USPKD UNPACKS A CHARACTER STRING INTO AN INTEGER ARRAY USPD0240
C                IN (A1) FORMAT.                                        USPD0250
C            2.  UP TO 129 CHARACTERS MAY BE USED.  ANY IN EXCESS OF    USPD0260
C                THAT ARE IGNORED.                                      USPD0270
C                                                                       USPD0280
C   COPYRIGHT           - 1982 BY IMSL, INC. ALL RIGHTS RESERVED.       USPD0290
C                                                                       USPD0300
C   WARRANTY            - IMSL WARRANTS ONLY THAT IMSL TESTING HAS BEEN USPD0310
C                           APPLIED TO THIS CODE. NO OTHER WARRANTY,    USPD0320
C                           EXPRESSED OR IMPLIED, IS APPLICABLE.        USPD0330
C                                                                       USPD0340
C-----------------------------------------------------------------------USPD0350
      SUBROUTINE USPKD  (PACKED,NCHARS,UNPAKD,NCHMTB)                   USPD0360
C                                  SPECIFICATIONS FOR ARGUMENTS         USPD0370
      INTEGER            NC,NCHARS,NCHMTB                               USPD0380
C                                                                       USPD0390
      INTEGER            UNPAKD(1),IBLANK                               USPD0400
      CHARACTER*(*)      PACKED                                         USPD0410
      DATA               IBLANK /1H /                                   USPD0420
C                                  INITIALIZE NCHMTB                    USPD0430
      NCHMTB = 0                                                        USPD0440
C                                  RETURN IF NCHARS IS LE ZERO          USPD0450
      IF(NCHARS.LE.0) RETURN                                            USPD0460
C                                  SET NC=NUMBER OF CHARS TO BE DECODED USPD0470
      NC = MIN0 (129,NCHARS)                                            USPD0480
      READ (PACKED,150) (UNPAKD(I),I=1,NC)                              USPD0490
  150 FORMAT (129A1)                                                    USPD0500
C                                  CHECK UNPAKD ARRAY AND SET NCHMTB    USPD0510
C                                  BASED ON TRAILING BLANKS FOUND       USPD0520
      DO 200 N = 1,NC                                                   USPD0530
         NN = NC - N + 1                                                USPD0540
         IF(UNPAKD(NN) .NE. IBLANK) GO TO 210                           USPD0550
  200 CONTINUE                                                          USPD0560
  210 NCHMTB = NN                                                       USPD0570
      RETURN                                                            USPD0580
      END                                                               USPD0590
